package cn.zn.modules.signature.service.impl;

import cn.zn.modules.pz.inter.vo.ElecSignVO;
import cn.zn.modules.pz.inter.ElecSignService;
import cn.zn.modules.pz.inter.enums.ElecSignTypeEnum;
import cn.zn.modules.signature.service.HtmlsignatureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service("elecSignService")
public class ElecSignServiceImpl implements ElecSignService {

    @Autowired
    private HtmlsignatureService htmlsignatureService;

    @Override
    public List<ElecSignVO> findSigns(String applyCode) {
        return htmlsignatureService.findSigns(applyCode).stream().map(o -> ElecSignVO.builder()
                .userCode(o.getWorkNo())
                .elecSignType(ElecSignTypeEnum.BASE64)
                .content(o.getImgData())
                .build()).collect(Collectors.toList());
    }
}
